/* GUI CONVERTED from rsrp12.p (converter v1.76) Fri Jun 14 09:29:48 2002 */
/* rsrp12.p - UNCONFIRMED PO SHIPPER REPORT                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.4 $                                        */
/*V8:ConvertMode=FullGUIReport                                          */

/* $Revision: 1.4 $ BY: Patrick Rowan DATE: 05/24/02  ECO: *P017* */

/*-----------------------------------------------------------------------------
  Purpose: This report shows all Purchase Order Shippers in the system that
           have not yet been received.
------------------------------------------------------------------------------*/

/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */
/*         THIS PROGRAM IS A BOLT-ON TO STANDARD PRODUCT MFG/PRO.           */
/* ANY CHANGES TO THIS PROGRAM MUST BE PLACED ON A SEPARATE ECO THAN        */
/* STANDARD PRODUCT CHANGES.  FAILURE TO DO THIS CAUSES THE BOLT-ON CODE TO */
/* BE COMBINED WITH STANDARD PRODUCT AND RESULTS IN PATCH DELIVERY FAILURES.*/
/*                                                                          */
/* -----  W A R N I N G  -----  W A R N I N G  -----  W A R N I N G  -----  */
/*                                                                          */



/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

          {mfdtitle.i}

         define variable supplier_from like vd_addr no-undo.
         define variable supplier_to like vd_addr no-undo.
         define variable site_from like si_site no-undo.
         define variable site_to like si_site no-undo.

         define temp-table tt_abs no-undo
                field tt_abs_shipper like abs_id
                field tt_abs_supplier like abs_shipfrom
                field tt_abs_shipto like abs_site
                index tt_abs_ix is unique primary tt_abs_shipper.

         /* SELECTION FORM A */
         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
             
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
supplier_from  colon 15
             supplier_to    colon 45 label {t001.i}
             site_from      colon 15
             site_to        colon 45 label {t001.i}
           SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* DISPLAY FORM B*/
         FORM /*GUI*/ 
            tt_abs_shipper  column-label "PO Shipper"
            tt_abs_supplier column-label "Supplier"
            tt_abs_shipto   column-label "Ship-To Site"
            with STREAM-IO /*GUI*/  frame b width 80 down.

         {wbrp01.i}

         
/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


             if supplier_to = hi_char then supplier_to = "".
             if site_from = hi_char   then site_from = "".

             if c-application-mode <> 'web':u then
                
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


            {wbrp06.i &command = update
                      &fields = "supplier_from supplier_to
                                 site_from site_to"
                      &frm = "a"}

            if (c-application-mode <> "WEB":U) or
               (c-application-mode <> "WEB":U and
               (c-web-request begins "DATA":U)) then do:

                bcdparm = "".
                {mfquoter.i supplier_from}
                {mfquoter.i supplier_to  }
                {mfquoter.i site_from    }
                {mfquoter.i site_to      }


                if supplier_to = "" then supplier_to = hi_char.
                if site_to = "" then site_to = hi_char.

            end. /* IF (c-application-mode */

            /* SELECT PRINTER */
            
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



            {mfphead.i}

            /* BEGIN FOR EACH ON abs_mstr */
            for each abs_mstr no-lock where
                     abs_type = "r"
                and  abs_id begins "s"
                and  substring(abs_status,2,1) = ""
                and  abs_shipfrom >= supplier_from
                and  abs_shipfrom <= supplier_to
                and  abs_shipto >= site_from
                and  abs_shipto <= site_to:

                /* LOAD TEMP-TABLE TO KEEP TRACK OF SHIPPERS */
                for first tt_abs no-lock where
                          tt_abs_shipper = abs_id:
                end.
                if available tt_abs then next.
                else do:
                   create tt_abs.
                   assign
                      tt_abs_shipper = abs_id
                      tt_abs_supplier = abs_shipfrom
                      tt_abs_shipto = abs_shipto
                      .
                end. /* ELSE DO */
            end. /* FOR EACH abs_mstr */

            /* READ TEMP-TABLE FOR REPORT DISPLAY */
            for each tt_abs no-lock:

                display
                  substring(tt_abs_shipper,2,20) @ tt_abs_shipper
                  tt_abs_supplier
                  tt_abs_shipto
                  with frame b STREAM-IO /*GUI*/ .
                  down 1 with frame b.

            end. /* FOR EACH tt_abs */

            /* REPORT TRAILER */
            
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


         end. /*REPEAT*/

         {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" supplier_from supplier_to site_from site_to "} /*Drive the Report*/
